#include <iostream>

using namespace std;

int main()
{
   int N,C1,C2,C3,C,DNEY;
   N=0; C1=31; C2=28; C3=30;
   cin >> N;
   switch (N){
   case 1:
       C=C1;
       cout << C1;
       break;
   case 2:
       C=C2;
       cout << C2;
       break;
   case 3:
       C=C1;
       cout << C1;
       break;
   case 4:
       C=C3;
       cout << C3;
       break;
   case 5:
       C=C1;
       cout << C1;
       break;
   case 6:
       C=C3;
       cout << C3;
       break;
   case 7:
       C=C1;
       cout << C1;
       break;
   case 8:
       C=C1;
       cout << C1;
       break;
   case 9:
       C=C3;
       cout << C3;
       break;
   case 10:
       C=C1;
       cout << C1;
       break;
   case 11:
       C=C3;
       cout << C3;
       break;
   case 12:
       C=C1;
       cout << C1;
       break;

   }
   DNEY=C2+7*C1+4*C3;
   cout << "Kolichestvo dney v nevisokosnom godu = " << DNEY;
   return 0;
}
